package com.frejoys.store.controller;

import com.frejoys.common.aop.Authority;
import com.frejoys.common.aop.Authorization;
import com.frejoys.common.constant.CommonConstant;
import com.frejoys.common.dto.store.StoreSaleListDto;
import com.frejoys.common.response.Result;
import com.frejoys.common.util.RequestUtil;
import com.frejoys.common.vo.store.StoreSaleVo;
import com.frejoys.service.StoreSaleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Tag(name = "销售记录", description = "销售记录")
@RestController
@RequiredArgsConstructor
@RequestMapping(CommonConstant.routePrefixStore)
@Authorization(Authority.Private)
public class MallStoreSaleController {

    private final StoreSaleService storeSaleService;


     @Operation(summary = "销售记录列表")
     @PostMapping("/storeSale/list")
     public Result<List<StoreSaleVo>> categoryList(@RequestBody @Validated StoreSaleListDto dto) {
         return Result.success(storeSaleService.getSaleList(dto, RequestUtil.userId()));
     }


}
